#include("../layout.html")
#@layout("媒体选项")

#define body()
<h1>媒体选项</h1>

<div class="layui-fluid">
	<form class="layui-form" action="/admin/option/media" method="post">
		<h2 class="title">图像大小</h2>
		<p>下面列出来的尺寸决定插入媒体库内的图像之最大尺寸。以像素为单位。</p>
		<div class="layui-form-item">
    		<label class="layui-form-label">缩略图大小</label>
    		<div class="layui-input-block">
    			<div class="layui-inline" style="width:150px;">宽度</div>
    			<div class="layui-inline" style="width:80px;">
    				<input type="number" name="thumbnail_size_w" id="thumbnail_size_w" value="#(thumbnail_size_w??)" class="layui-input">
    			</div>
   	 		</div>
   	 		<div class="layui-input-block">
    			<div class="layui-inline" style="width:150px;">高度</div>
    			<div class="layui-inline" style="width:80px;">
    				<input type="number" name="thumbnail_size_h" id="thumbnail_size_h" value="#(thumbnail_size_h??)" class="layui-input">
    			</div>
   	 		</div>
   	 		<div class="layui-input-block">
    			<input type="checkbox" name="thumbnail_crop" id="thumbnail_crop" data="#(thumbnail_crop??)" value="1" title="总是裁剪缩略图到这个尺寸（一般情况下，缩略图应保持原始比例）" lay-skin="primary">
   	 		</div>
    	</div>
    	<div class="layui-form-item">
    		<label class="layui-form-label">中等大小</label>
    		<div class="layui-input-block">
    			<div class="layui-inline" style="width:150px;">最大宽度</div>
    			<div class="layui-inline" style="width:80px;">
    				<input type="number" name="medium_size_w" id="medium_size_w" value="#(medium_size_w??)" class="layui-input">
    			</div>
   	 		</div>
   	 		<div class="layui-input-block">
    			<div class="layui-inline" style="width:150px;">最大高度</div>
    			<div class="layui-inline" style="width:80px;">
    				<input type="number" name="medium_size_h" id="medium_size_h" value="#(medium_size_h??)" class="layui-input">
    			</div>
   	 		</div>
    	</div>
    	<div class="layui-form-item">
    		<label class="layui-form-label">大尺寸</label>
    		<div class="layui-input-block">
    			<div class="layui-inline" style="width:150px;">最大宽度</div>
    			<div class="layui-inline" style="width:80px;">
    				<input type="number" name="large_size_w" id="large_size_w" value="#(large_size_w??)" class="layui-input">
    			</div>
   	 		</div>
   	 		<div class="layui-input-block">
    			<div class="layui-inline" style="width:150px;">最大高度</div>
    			<div class="layui-inline" style="width:80px;">
    				<input type="number" name="large_size_h" id="large_size_h" value="#(large_size_h??)" class="layui-input">
    			</div>
   	 		</div>
    	</div>
    	
    	<h2 class="title">文件上传</h2>
    	
    	<div class="layui-form-item">
    		<input type="checkbox" name="uploads_use_yearmonth_folders" id="uploads_use_yearmonth_folders" data="#(uploads_use_yearmonth_folders??)" value="1" title="以年—月目录形式组织上传内容" lay-skin="primary">
    	</div>
    	<div class="layui-form-item">
    		<button type="submit" lay-submit lay-filter="*" class="layui-btn layui-btn-sm">保存更改</button>
    	</div>
    </form>
</div>
#end

#define foot()
<script>
layui.cache.page = 'option';
layui.use('tbynet', function(){
	var $ = layui.$
	,form = layui.form
	,tbynet = layui.tbynet;
	
	//checkbox
	if(1 == $('#thumbnail_crop').attr('data')) {
		$('#thumbnail_crop').prop('checked', true);
	} else {
		$('#thumbnail_crop').prop('checked', false);
	}
	
	if(1 == $('#uploads_use_yearmonth_folders').attr('data')) {
		$('#uploads_use_yearmonth_folders').prop('checked', true);
	} else {
		$('#uploads_use_yearmonth_folders').prop('checked', false);
	}
	
	form.render();
});
</script>
#end